package cn.stylefeng.guns.modular.business.frequency.orderstatuschange.controller;

import cn.stylefeng.guns.core.annotion.BusinessLog;
import cn.stylefeng.guns.core.enums.LogAnnotionOpTypeEnum;
import cn.stylefeng.guns.core.pojo.response.ResponseData;
import cn.stylefeng.guns.core.pojo.response.SuccessResponseData;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import cn.stylefeng.guns.modular.business.frequency.orderstatuschange.service.OrderStatusChangeService;
import cn.stylefeng.guns.modular.business.frequency.orderstatuschange.model.param.OrderStatusChangeParam;

import javax.annotation.Resource;

/**
 * tt_order_status_change 控制器
 *
 * @author: yujie
 * @date: 2023/07/11 15:44
 */
@RestController
public class OrderStatusChangeController {

    @Resource
    private OrderStatusChangeService orderStatusChangeService;

    /**
     * 分页查询tt_order_status_change
     *
     * @author yujie
     * @date 2023/07/11 15:44
     */
    @GetMapping("/orderStatusChange/page")
    @BusinessLog(title = "tt_order_status_change_分页查询", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData page(OrderStatusChangeParam orderStatusChangeParam) {
        return new SuccessResponseData(orderStatusChangeService.page(orderStatusChangeParam));
    }

    /**
     * 获取全部tt_order_status_change
     *
     * @author yujie
     * @date 2023/07/11 15:44
     */
    @GetMapping("/orderStatusChange/list")
    @BusinessLog(title = "tt_order_status_change_查询所有", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData list(OrderStatusChangeParam orderStatusChangeParam) {
        return new SuccessResponseData(orderStatusChangeService.list(orderStatusChangeParam));
    }

    /**
     * 查看详情tt_order_status_change
     *
     * @author yujie
     * @date 2023/07/11 15:44
     */
    @GetMapping("/orderStatusChange/detail")
    @BusinessLog(title = "tt_order_status_change_查看详情", opType = LogAnnotionOpTypeEnum.DETAIL)
    public ResponseData detail(@Validated(OrderStatusChangeParam.detail.class) OrderStatusChangeParam orderStatusChangeParam) {
        return new SuccessResponseData(orderStatusChangeService.detail(orderStatusChangeParam));
    }

    /**
     * 添加tt_order_status_change
     *
     * @author yujie
     * @date 2023/07/11 15:44
     */
    @PostMapping("/orderStatusChange/add")
    @BusinessLog(title = "tt_order_status_change_增加", opType = LogAnnotionOpTypeEnum.ADD)
    public ResponseData add(@RequestBody @Validated(OrderStatusChangeParam.add.class) OrderStatusChangeParam orderStatusChangeParam) {
        orderStatusChangeService.add(orderStatusChangeParam);
        return new SuccessResponseData();
    }

    /**
     * 删除tt_order_status_change
     *
     * @author yujie
     * @date 2023/07/11 15:44
     */
    @PostMapping("/orderStatusChange/delete")
    @BusinessLog(title = "tt_order_status_change_删除", opType = LogAnnotionOpTypeEnum.DELETE)
    public ResponseData delete(@RequestBody @Validated(OrderStatusChangeParam.delete.class) OrderStatusChangeParam orderStatusChangeParam) {
        orderStatusChangeService.delete(orderStatusChangeParam);
        return new SuccessResponseData();
    }

    /**
     * 编辑tt_order_status_change
     *
     * @author yujie
     * @date 2023/07/11 15:44
     */
    @PostMapping("/orderStatusChange/edit")
    @BusinessLog(title = "tt_order_status_change_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    public ResponseData edit(@RequestBody @Validated(OrderStatusChangeParam.edit.class) OrderStatusChangeParam orderStatusChangeParam) {
        orderStatusChangeService.edit(orderStatusChangeParam);
        return new SuccessResponseData();
    }


}
